import React, { PureComponent } from "react"
// 1. 创建一个context
import ThemeContext from "./context/theme-context"
import Home from "./components/Home"

export default class App extends PureComponent {
  constructor() {
    super()
    this.state = {
      info: {
        name: "name",
        pwd: "password"
      }
    }
  }

  render() {
    const { info } = this.state
    return (
      <div>
        {/* 2. 包裹并通过value传递共享数据*/}
        {/*类组件的context共享数据*/}
        <ThemeContext.Provider value={{ color: "red" }}>
          <Home {...info} />
        </ThemeContext.Provider>
      </div>
    )
  }
}
